package com.qf.pojo;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author Wy
 * @version V1.0
 * @Project day44-1
 * @Package ${PACKAGE_NAME}
 * @Description: ${TODO}
 * @Date 2022/5/17 21:12
 */
@WebServlet(name = "registServlet" ,urlPatterns = "/registServlet")
public class registServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
                 request.setCharacterEncoding("utf-8");
                 response.setContentType("text/html; charset=UTF-8");
        String name = request.getParameter("name");
        String result=null;
        if(name.equals("root")||name.equals("admin")){
              result="2";
        }else{
            result="1";
        }
        response.getWriter().write(result);

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            doPost(request,response);
    }
}
